// =====================================================================
// <copyright file="Resources1.cs" author="David R. Guindo">
// 	Copyright (C) 2013. All rights reserved.
// </copyright>
// =====================================================================
// This code is released under the terms of the Apache 2.0 license, 
// http://apache.org/licenses/LICENSE-2.0.html
// =====================================================================

namespace AppBlock.Core.Resources
{
    using System;
    using System.CodeDom.Compiler;
    using System.Globalization;
    using System.Resources;
    using System.Threading;

    /// <summary>
    ///     Strongly-typed and parameterized string resources.
    /// </summary>
    [GeneratedCode("Resources.tt", "1.0.0.0")]
    [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
    internal static class Strings
    {
        /// <summary>
        ///     A string like "Property '{0}' can't be null"
        /// </summary>
        internal static string ArgumentHelper_IsNotNull(object p0)
        {
            return EntityRes.GetString(EntityRes.ArgumentHelper_IsNotNull, p0);
        }

        /// <summary>
        ///     A string like "Exception_Config"
        /// </summary>
        internal static string Exception_Config
        {
            get { return EntityRes.GetString(EntityRes.Exception_Config); }
        }

        /// <summary>
        ///     A string like "Exception_Core"
        /// </summary>
        internal static string Exception_Core
        {
            get { return EntityRes.GetString(EntityRes.Exception_Core); }
        }

        /// <summary>
        ///     A string like "Exception_Delete"
        /// </summary>
        internal static string Exception_Delete
        {
            get { return EntityRes.GetString(EntityRes.Exception_Delete); }
        }

        /// <summary>
        ///     A string like "Exception_EntityNotFound"
        /// </summary>
        internal static string Exception_EntityNotFound
        {
            get { return EntityRes.GetString(EntityRes.Exception_EntityNotFound); }
        }

        /// <summary>
        ///     A string like "Exception_EntityWithDepencies"
        /// </summary>
        internal static string Exception_EntityWithDepencies
        {
            get { return EntityRes.GetString(EntityRes.Exception_EntityWithDepencies); }
        }

        /// <summary>
        ///     A string like "Exception_Invalid"
        /// </summary>
        internal static string Exception_Invalid
        {
            get { return EntityRes.GetString(EntityRes.Exception_Invalid); }
        }

        /// <summary>
        ///     A string like "Exception_Validation"
        /// </summary>
        internal static string Exception_Validation
        {
            get { return EntityRes.GetString(EntityRes.Exception_Validation); }
        }

        /// <summary>
        ///     A string like "Property '{0}' is null, empty or white space"
        /// </summary>
        internal static string IsNotNullOrWhiteSpace(object p0)
        {
            return EntityRes.GetString(EntityRes.IsNotNullOrWhiteSpace, p0);
        }
    }

    /// <summary>
    ///     Strongly-typed and parameterized exception factory.
    /// </summary>
    [GeneratedCode("Resources.tt", "1.0.0.0")]
    [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
    internal static class ErrorMsg
    {
        /// <summary>
        ///     System.ArgumentException with message like "Property '{0}' can't be null"
        /// </summary>
        internal static Exception ArgumentHelper_IsNotNull(object p0)
        {
            return new System.ArgumentException(Strings.ArgumentHelper_IsNotNull(p0));
        }

        /// <summary>
        ///     System.ArgumentException with message like "Property '{0}' is null, empty or white space"
        /// </summary>
        internal static Exception IsNotNullOrWhiteSpace(object p0)
        {
            return new System.ArgumentException(Strings.IsNotNullOrWhiteSpace(p0));
        }

        /// <summary>
        ///     The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not
        ///     accept it as a valid argument.
        /// </summary>
        internal static Exception ArgumentNull(string paramName)
        {
            return new ArgumentNullException(paramName);
        }

        /// <summary>
        ///     The exception that is thrown when the value of an argument is outside the allowable range of values as defined by
        ///     the invoked method.
        /// </summary>
        internal static Exception ArgumentOutOfRange(string paramName)
        {
            return new ArgumentOutOfRangeException(paramName);
        }

        /// <summary>
        ///     The exception that is thrown when the author has yet to implement the logic at this point in the program. This can
        ///     act as an exception based TODO tag.
        /// </summary>
        internal static Exception NotImplemented()
        {
            return new NotImplementedException();
        }

        /// <summary>
        ///     The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or
        ///     write to a stream that does not support the invoked functionality.
        /// </summary>
        internal static Exception NotSupported()
        {
            return new NotSupportedException();
        }
    }

    /// <summary>
    ///     AutoGenerated resource class. Usage:
    ///     string s = EntityRes.GetString(EntityRes.MyIdenfitier);
    /// </summary>
    [GeneratedCode("Resources.tt", "1.0.0.0")]
    [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
    internal sealed class EntityRes
    {
        internal const string ArgumentHelper_IsNotNull = "ArgumentHelper_IsNotNull";
        internal const string Exception_Config = "Exception_Config";
        internal const string Exception_Core = "Exception_Core";
        internal const string Exception_Delete = "Exception_Delete";
        internal const string Exception_EntityNotFound = "Exception_EntityNotFound";
        internal const string Exception_EntityWithDepencies = "Exception_EntityWithDepencies";
        internal const string Exception_Invalid = "Exception_Invalid";
        internal const string Exception_Validation = "Exception_Validation";
        internal const string IsNotNullOrWhiteSpace = "IsNotNullOrWhiteSpace";

        private static EntityRes loader = null;
        private ResourceManager resources;

        private EntityRes()
        {
            var @namespace = this.GetType()
                .FullName.Replace(string.Format(".Resources.{0}", this.GetType().Name), ".Resources");
            var @type = this.GetType().Assembly;

            resources = new ResourceManager(@namespace, @type);
        }

        private static EntityRes GetLoader()
        {
            if (loader == null)
            {
                EntityRes sr = new EntityRes();
                Interlocked.CompareExchange(ref loader, sr, null);
                sr.resources = new ResxManager<AppBlock.Core.Properties.Resources>();
            }
            return loader;
        }

        //private static CultureInfo Culture { get { return Thread.CurrentThread.CurrentCulture; } }
        private static CultureInfo Culture
        {
            get { return new CultureInfo("En-US"); }
        }

        public static ResourceManager Resources
        {
            get { return GetLoader().resources; }
        }

        public static string GetString(string name, params object[] args)
        {
            EntityRes sys = GetLoader();
            if (sys == null)
                return null;
            string res = sys.resources.GetString(name, EntityRes.Culture);

            if (args != null && args.Length > 0)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    String value = args[i] as String;
                    if (value != null && value.Length > 1024)
                    {
                        args[i] = value.Substring(0, 1024 - 3) + "...";
                    }
                }
                return String.Format(CultureInfo.CurrentCulture, res, args);
            }
            else
            {
                return res;
            }
        }

        public static string GetString(string name)
        {
            EntityRes sys = GetLoader();
            if (sys == null)
                return null;
            return sys.resources.GetString(name, EntityRes.Culture);
        }

        public static string GetString(string name, out bool usedFallback)
        {
            // always false for this version of gensr
            usedFallback = false;
            return GetString(name);
        }

        public static object GetObject(string name)
        {
            EntityRes sys = GetLoader();
            if (sys == null)
                return null;
            return sys.resources.GetObject(name, EntityRes.Culture);
        }
    }
}